using System.ComponentModel;
using System.IO.Ports;
using Tool;

namespace SerialPortCommunicationProject
{
    class Data : ViewModelBase
    {
        private string portName;
        private int baudRate;
        private Parity parity;
        private int dataBits;
        private StopBits stopBits;

        private bool isServer;
        private string ip;
        private int port;

        private bool isOpen;

        private Data()
        {

        }
        public static Data GetInstance()
        {
            return new Data();
        }
        public string PortName
        {
            get => portName;
            set
            {
                portName = value;
                RaisePropertyChanged("PortName");
            }
        }
        public int BaudRate
        {
            get => baudRate;
            set
            {
                baudRate = value;
                RaisePropertyChanged("BaudRate");
            }
        }
        public Parity Parity
        {
            get => parity;
            set
            {
                parity = value;
                RaisePropertyChanged("Parity");
            }
        }
        public int DataBits
        {
            get => dataBits;
            set
            {
                dataBits = value;
                RaisePropertyChanged("DataBits");
            }
        }
        public StopBits StopBits
        {
            get => stopBits;
            set
            {
                stopBits = value;
                RaisePropertyChanged("StopBits");
            }
        }
        public bool IsServer
        {
            get => isServer;
            set
            {
                isServer = value;
                RaisePropertyChanged("IsServer");
            }
        }
        public string Ip
        {
            get => ip;
            set
            {
                ip = value;
                RaisePropertyChanged("Ip");
            }
        }
        public int Port
        {
            get => port;
            set
            {
                port = value;
                RaisePropertyChanged("Port");
            }
        }

        public bool IsOpen
        {
            get => isOpen;
            set
            {
                isOpen = value;
                RaisePropertyChanged("IsOpen");
            }
        }
    }
}

    
